package com.imon.groovybox

class SubTitle {
	String name
	String href

	String toString() {
		"Name: ${name} - Href ${href}"	
	}
}

SubTitle mapSubTitle(xmlData) {
	if (xmlData.title.size()) {
		SubTitle s = new SubTitle()
		s.name = xmlData.title
		s.href = xmlData.link
		
		return s
	}

	return null	
}

def data = new XmlSlurper().parse(new File("src/main/resources/bbcfeed.xml"))
println mapSubTitle(data.channel.item[0])
println mapSubTitle(data.channel.item[1])